#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;

char tmp[105];
int ispre(int k)
{
	int aa[105],cc[105];
	int b=k;
	
	memset(cc,0,sizeof(cc));
	int lena=strlen(tmp);
	for (int i=1;i<=lena;i++)
		aa[i]=tmp[i-1]-48;
	int x=0;
	for (int i=1;i<=lena;i++)
	{
		cc[i]=(x*10+aa[i])/b;
		x=(x*10+aa[i])%b;
	}
	return x;
}

int main()
{
	cin>>tmp;
	
	int js=0;
	for (int i=2;i<=9;i++)
	{
		if (ispre(i)==0) 
		{
			js++;
			cout<<i<<' ';	
		}
	}
	if (!js) cout<<"none"<<endl;
	
	return 0;
}